const api = require('../../utils/api'); 
Component({
    properties: {
        title: {
            type: String, // 参数类型
            value: '买车请联系客服'     // 默认值
        }
    },
    data: {
      list: [],
      phone:'18133272448'
    },
    lifetimes: {
      attached() {
        // 组件实例进入页面节点树时触发
        this.getPhoneFn()
      }
    },
    methods: {
        copyText() {
            const that = this;
            // 使用 wx.setClipboardData 将文本内容写入剪贴板
            wx.setClipboardData({
                data: that.data.phone,
                success: (res)=> {
                    wx.showToast({
                        title: '复制成功',
                        icon: 'success',
                        duration: 2000
                    });
                }
              })
          },
        getPhoneFn(){
            console.log('获取手机号')
            api.dictType('platform_phone').then(res=>{
              console.log(res)
              if(res.code == 200){
                this.setData({
                    phone:res.data[0].dictLabel
               })
              }
            })
          },
    }
  });
